package com.guigu.www.controller;

import com.guigu.www.pojo.Menus;
import com.guigu.www.pojo.Roles;
import com.guigu.www.service.MenuRolesService;
import com.guigu.www.service.MenusService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

@RestController
public class RoleMenusController {
    @Autowired
    MenuRolesService service;
    @Autowired
    MenusService menusService;
    @RequestMapping("addmenuroles.action")
    public Map addmenuroles(@RequestBody Roles roles){
        Map map=new HashMap();
        boolean res=service.addmenuroles(roles);
        map.put("msg","授予菜单失败");
        if(res){
            map.put("msg","授予菜单成功");
        }
        return map;
    }
    @RequestMapping("queryquanxianbyroleid.action/{roleid}")
    public List<Menus> queryquanxianbyroleid(@PathVariable int roleid){
        List<Menus> list=menusService.queryquanxianbyroleid(roleid);
        return list;
    }
}
